import request from '@/utils/request'

export const prefix = 'flowable';

// 查询流程列表
export function listProcess(page,data) {
  return request({
    url: `/${prefix}/process/list`,
    method: 'post',
    params: page,
    data: data
  })
}

// 查询流程表单
export function getProcessForm(query) {
  return request({
    url: `/${prefix}/process/getProcessForm`,
    method: 'get',
    params: query
  })
}

// 查询流程表单
export function getProcessExternalForm(query) {
  return request({
    url: `/${prefix}/process/getDeployExternalForm`,
    method: 'get',
    params: query
  })
}

// 部署流程实例
export function startProcess(processDefId, data) {
  return request({
    url: `/${prefix}/process/start/${processDefId}`,
    method: 'post',
    data: data
  })
}

// 删除流程实例
export function delProcess(data) {
  return request({
    url: `/${prefix}/process/delete`,
    method: 'post',
    data: data
  })
}

// 获取流程图
export function getBpmnXml(processDefId) {
  return request({
    url: `/${prefix}/process/bpmnXml/${processDefId}`,
    method: 'get'
  })
}

export function detailProcess(query) {
  return request({
    url: `/${prefix}/process/detail`,
    method: 'get',
    params: query
  })
}

// 我的发起的流程
export function listOwnProcess(page,data) {
  return request({
    url: `/${prefix}/process/ownList`,
    method: 'post',
    params: page,
    data: data
  })
}

// 我待办的流程
export function listTodoProcess(query) {
  return request({
    url: `/${prefix}/process/todoList`,
    method: 'get',
    params: query
  })
}

// 我待签的流程
export function listClaimProcess(page,data) {
  return request({
    url: `/${prefix}/process/claimList`,
    method: 'post',
    params: page,
    data: data
  })
}

// 我已办的流程
export function listFinishedProcess(page,data) {
  return request({
    url: `/${prefix}/process/finishedList`,
    method: 'post',
    params: page,
    data: data
  })
}

// 查询流程抄送列表
export function listCopyProcess(page,data) {
  return request({
    url: `/${prefix}/process/copyList`,
    method: 'post',
    params: page,
    data: data
  })
}

// 查询流程抄送列表
export function deleteCopyList(data) {
  return request({
    url: `/${prefix}/process/deleteCopyList`,
    method: 'post',
    data: data
  })
}

// 取消申请
export function stopProcess(data) {
  return request({
    url: `/${prefix}/task/stopProcess`,
    method: 'post',
    data: data
  })
}